package cn.edu.qzuie.artist.module.td.dal.mysql.student;

import java.util.*;

import cn.edu.qzuie.artist.framework.common.pojo.PageResult;
import cn.edu.qzuie.artist.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.edu.qzuie.artist.framework.mybatis.core.mapper.BaseMapperX;
import cn.edu.qzuie.artist.module.td.dal.dataobject.student.StudentDO;
import cn.edu.qzuie.artist.module.td.dal.dataobject.teacher.TeacherDO;
import org.apache.ibatis.annotations.Mapper;
import cn.edu.qzuie.artist.module.td.controller.admin.student.vo.*;

/**
 * 学生 Mapper
 *
 * @author 泉信管理员
 */
@Mapper
public interface StudentMapper extends BaseMapperX<StudentDO> {

    default StudentDO selectByStudentNo(String StudentNo){
        return selectOne(StudentDO::getStudentNo,StudentNo);
    }

    default PageResult<StudentDO> selectPage(StudentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudentDO>()
                .likeIfPresent(StudentDO::getStudentNo, reqVO.getStudentNo())
                .likeIfPresent(StudentDO::getMobile, reqVO.getMobile())
                .likeIfPresent(StudentDO::getNickName, reqVO.getNickName())
                .likeIfPresent(StudentDO::getRealName, reqVO.getRealName())
                .eqIfPresent(StudentDO::getStudentState, reqVO.getStudentState())
                .eqIfPresent(StudentDO::getMajorId, reqVO.getMajorId())
                .eqIfPresent(StudentDO::getClassinfoId, reqVO.getClassinfoId())
                .orderByDesc(StudentDO::getId));
    }

}